package com.iflysse.mapper;


import com.iflysse.pojo.Users;
import com.iflysse.pojo.bo.req.QueryUserInfoBoReq;
import com.iflysse.pojo.bo.req.UserBoReq;
import com.iflysse.pojo.bo.resp.QueryUserInfoBoResp;
import com.iflysse.pojo.po.resp.UserPoResp;
import com.iflysse.pojo.vo.req.ResetPasswordVoReq;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper {

    @Select("select account_id as userId,role from tb_account where account_number =  #{userName}")
    UserPoResp getByUserName(String userName);

    @Select("select account_id as UserId,role from tb_account where account_number= #{userName} and password = #{passWord}")
    UserPoResp login(UserBoReq userBoReq);

    @Update("update tb_account set password=#{confirmPassword} where account_number=#{userId}")
    void resetPassword(ResetPasswordVoReq resetPasswordVoReq);

    @Select("select * from tb_account where account_number =  #{accountNumber}")
    List<Users> selectById(String accountNumber);

    @Select("select * from tb_account ,tb_student where tb_account.email = #{email} and tb_student.student_name = #{student_name}")
    List<Users> checkstuname_email(String student_name,String email);

    @Select("")
    QueryUserInfoBoResp selectByBothId(QueryUserInfoBoReq queryUserInfoBoReq);
}
